﻿<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:asp="remove">

	<xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="yes"/>

	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultstring">
				<xsl:value-of select="/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultstring" />
			</xsl:when>
      <xsl:when test="/SOAP-ENV:Envelope/SOAP-ENV:Body/Result/Item">
        <table cellpadding="3">
          <tr>
            <th>
              ECO #
            </th>
            <th>
              Description
            </th>
            <th>
              Reason
            </th>
            <th>
              State
            </th>
            <th>
              Category
            </th>
            <th>
              Originator
            </th>
            <th>
              Analyst
            </th>
          </tr>
          <xsl:apply-templates/>
        </table>
      </xsl:when>
			<xsl:otherwise>
				ECOs not found
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Item">
		<tr>
			<td>
				<xsl:value-of select="item_number" />
			</td>
			<td>
				<xsl:value-of select="description" />
			</td>
      <td>
        <xsl:value-of select="change_reason" />
      </td>
			<td>
				<xsl:value-of select="state" />
			</td>
			<td>
				<xsl:value-of select="change_category" />
			</td>
			<td>
				<xsl:value-of select="created_by_id/@keyed_name" />
			</td>
			<td>
				<xsl:value-of select="managed_by_id/@keyed_name" />
			</td>
		</tr>
	</xsl:template>

</xsl:stylesheet>